/*
 * CSPSystemMessage.h - The lil text that you never read...
 * Created January 12, 2007, by Michael 'Bigcheese' Spencer.
 *
 * Copyright (C) 2007 Michael Spencer
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * Michael Spencer - bigcheesegs@gmail.com
 */

#ifndef _ADENA_C_S_P_SYSTEM_MESSAGE_H_
#define _ADENA_C_S_P_SYSTEM_MESSAGE_H_

#include <CServerPacket.h>
#include <irrString.h>
#include <irrList.h>

namespace adena
{
namespace game_server
{
	enum E_AddType
	{		
		EAT_TEXT = 0,
		EAT_NUMBER = 1,
		EAT_NPC_NAME = 2,
		EAT_ITEM_NAME = 3,
		EAT_SKILL_NAME = 4
	};

	// Taken from l2j.
	enum E_MessageId
	{
		//PeaceZones
		EMI_TARGET_IN_PEACEZONE = 85,
		EMI_CANT_ATK_PEACEZONE = 84,

		// magic related
		EMI_NOT_ENOUGH_HP = 23,
		EMI_NOT_ENOUGH_MP = 24,
		EMI_NOT_ENOUGH_ITEMS = 351,

		EMI_USE_S1 = 46,
		EMI_S1_PREPARED_FOR_REUSE = 48,
		EMI_YOU_FEEL_S1_EFFECT = 110,
		EMI_REJUVENATING_HP = 25,
		EMI_REJUVENATING_MP = 26,
		EMI_CANNOT_USE_ITEM_WHILE_USING_MAGIC = 104,
		EMI_CASTING_INTERRUPTED = 27,
		EMI_S1_WAS_UNAFFECTED_BY_S2 = 139,
		EMI_DRAIN_HALF_SUCCESFUL = 156,
		EMI_RESISTED_S1_DRAIN = 157,
		EMI_ATTACK_FAILED = 158,
		EMI_RESISTED_S1_MAGIC = 159,
		EMI_S1_HP_RESTORED = 1066,
		EMI_S2_HP_RESTORED_BY_S1 = 1067,
		EMI_S1_MP_RESTORED = 1068,
		EMI_S2_MP_RESTORED_BY_S1 = 1069,

		EMI_EARNED_S2_S1_s = 53,
		EMI_EARNED_ITEM = 54,
		EMI_EARNED_ADENA = 52,
		EMI_DISSAPEARED_ITEM = 301,
		EMI_DISSAPEARED_ADENA = 672,

		EMI_SOUL_CRYSTAL_ABSORBING_SUCCEEDED = 974,
		EMI_SOUL_CRYSTAL_ABSORBING_FAILED = 975,
		EMI_SOUL_CRYSTAL_BROKE = 976,
		EMI_SOUL_CRYSTAL_ABSORBING_FAILED_RESONATION = 977,
		EMI_SOUL_CRYSTAL_ABSORBING_REFUSED = 978,

		EMI_YOU_DID_S1_DMG = 0x23,
		EMI_S1_GAVE_YOU_S2_DMG = 0x24,
		EMI_EFFECT_S1_DISAPPEARED = 0x5c,
		EMI_YOU_EARNED_S1_EXP_AND_S2_SP = 0x5f,
		EMI_YOU_INCREASED_YOUR_LEVEL = 0x60,

		EMI_NOTHING_HAPPENED = 61,
		EMI_ITEM_MISSING_TO_LEARN_SKILL = 0x114,
		EMI_LEARNED_SKILL_S1 = 0x115,
		EMI_NOT_ENOUGH_SP_TO_LEARN_SKILL = 0x116,
		EMI_DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN = 607,

		EMI_FALL_DAMAGE_S1 = 0x128,
		EMI_DROWN_DAMAGE_S1 = 0x129,

		EMI_YOU_DROPPED_S1 = 0x12a,
		EMI_TARGET_IS_NOT_FOUND_IN_THE_GAME = 0x91,
		EMI_TARGET_CANT_FOUND = 50,
		EMI_TARGET_MUST_BE_IN_CLAN = 234,

		EMI_CANNOT_BE_RESURRECTED_DURING_SIEGE = 1053,

		EMI_SOULSHOTS_GRADE_MISMATCH = 0x151,
		EMI_NOT_ENOUGH_SOULSHOTS = 0x152,
		EMI_ENABLED_SOULSHOT = 342,
		EMI_CANNOT_USE_SOULSHOTS = 0x153,
		EMI_SPIRITSHOTS_GRADE_MISMATCH = 530,
		EMI_NOT_ENOUGH_SPIRITSHOTS = 531,
		EMI_CANNOT_USE_SPIRITSHOTS = 532,
		EMI_ENABLED_SPIRITSHOT = 533,
		EMI_USE_OF_S1_WILL_BE_AUTO = 1433,
		EMI_AUTO_USE_OF_S1_CANCELLED = 1434,

		EMI_S1_IS_NOT_ONLINE = 3,

		EMI_GETTING_READY_TO_SHOOT_AN_ARROW    =   41,
		EMI_AVOIDED_S1s_ATTACK                 =   42,
		EMI_MISSED_TARGET                      =   43,
		EMI_CRITICAL_HIT                       =   44,
		EMI_CRITICAL_HIT_BY_PET                = 1017,
		EMI_CRITICAL_HIT_BY_SUMMONED_MOB       = 1028,
		EMI_CRITICAL_HIT_MAGIC                 = 1280,
		EMI_SHIELD_DEFENCE_SUCCESSFULL         =  111,
		EMI_YOUR_EXCELLENT_SHIELD_DEFENSE_WAS_A_SUCCESS = 1281,
		EMI_OVER_HIT                           =  361,
		EMI_ACQUIRED_BONUS_EXPERIENCE_THROUGH_OVER_HIT  =  362,
		EMI_CANT_MOVE_SITTING = 31,
		EMI_SYMBOL_ADDED = 877,
		EMI_CANT_DRAW_SYMBOL = 899,

		EMI_SKILL_NOT_AVAILABLE             = 0x30,

		EMI_CANT_SEE_TARGET                 = 0xb5,

		//  Spoil & Sweep
		EMI_SWEEPER_FAILED_TARGET_NOT_SPOILED  =  343,
		EMI_ALREDAY_SPOILED                    =  357,
		EMI_S1_SWEEPED_UP_S2_S3                =  608,
		EMI_S1_SWEEPED_UP_S2                   =  609,
		EMI_SPOIL_SUCCESS                      =  612,
		EMI_SPOIL_CANNOT_USE                   =  661,
		EMI_SWEEP_NOT_ALLOWED                  =  683,

		// party related 
		EMI_WAITING_FOR_REPLY = 164,

		EMI_S1_INVITED_YOU_TO_PARTY_FINDER_KEEPER = 572,
		EMI_S1_INVITED_YOU_TO_PARTY_RANDOM = 573,

		EMI_S1_INVITED_YOU_TO_PARTY = 66,
		EMI_YOU_INVITED_S1_TO_PARTY = 105,

		EMI_OTHER_PARTY_IS_DROZEN = 692,

		EMI_YOU_JOINED_S1_PARTY = 106,
		EMI_S1_JOINED_PARTY = 107,
		EMI_S1_LEFT_PARTY = 108,
		EMI_YOU_LEFT_PARTY = 200,
		EMI_ONLY_LEADER_CAN_INVITE = 154,

		EMI_S1_DID_NOT_REPLY = 135,
		EMI_YOU_DID_NOT_REPLY = 136,

		EMI_PLAYER_DECLINED = 305,

		EMI_PARTY_FULL = 155,
		EMI_S1_IS_ALREADY_IN_PARTY = 160,
		EMI_INVITED_USER_NOT_ONLINE = 161,

		EMI_PARTY_DISPERSED = 203,

		EMI_S1_HAS_BECOME_A_PARTY_LEADER = 1384,
		EMI_ONLY_A_PARTY_LEADER_CAN_TRANSFER_ONES_RIGHTS_TO_ANOTHER_PLAYER = 0x577,
		EMI_PLEASE_SELECT_THE_PERSON_TO_WHOM_YOU_WOULD_LIKE_TO_TRANSFER_THE_RIGHTS_OF_A_PARTY_LEADER = 0x0578,
		EMI_YOU_CANNOT_TRANSFER_RIGHTS_TO_YOURSELF = 0x0579,
		EMI_YOU_CAN_TRANSFER_RIGHTS_ONLY_TO_ANOTHER_PARTY_MEMBER = 0x057A,
		EMI_YOU_HAVE_FAILED_TO_TRANSFER_THE_PARTY_LEADER_RIGHTS = 0x057B,

		//weight & inventory
		EMI_WEIGHT_LIMIT_EXCEEDED = 422,
		EMI_NOT_ENOUGH_ARROWS = 112,
		EMI_SLOTS_FULL = 129,
		EMI_CANNOT_DISCARD_EXCHANGE_ITEM = 603,
		EMI_CANNOT_DISCARD_DISTANCE_TOO_FAR = 151,
		EMI_CANNOT_DISCARD_THIS_ITEM = 98,

		// trade 
		EMI_S1_IS_BUSY_TRY_LATER = 153,
		EMI_TARGET_IS_INCORRECT = 144,
		EMI_ALREADY_TRADING = 142,
		EMI_REQUEST_S1_FOR_TRADE = 118,
		EMI_S1_DENIED_TRADE_REQUEST = 119,
		EMI_BEGIN_TRADE_WITH_S1 = 120,
		EMI_S1_CONFIRMED_TRADE = 121,
		EMI_TRADE_SUCCESSFUL = 123,
		EMI_S1_CANCELED_TRADE = 124,
		EMI_CANNOT_USE_ITEM_WHILE_TRADING = 149,

		//private store & store
		EMI_S1_PURCHASED_S2 = 378,
		EMI_S1_PURCHASED_S2_S3 = 379,
		EMI_S1_PURCHASED_S3_S2_s = 380,
		EMI_PURCHASED_S2_FROM_S1 = 559,
		EMI_PURCHASED_S2_S3_FROM_S1 =560,
		EMI_PURCHASED_S3_S2_s_FROM_S1 =561,
		EMI_THE_PURCHASE_IS_COMPLETE =700,
		EMI_THE_PURCHASE_PRICE_IS_HIGHER_THAN_MONEY = 720,
		EMI_YOU_NOT_ENOUGH_ADENA = 279,
		EMI_CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE = 1065,
		EMI_YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED = 1036,

		//Community Board
		EMI_NO_CB_IN_MY_CLAN = 1050,
		EMI_CB_OFFLINE = 938,

		//Clan stuff
		EMI_FAILED_TO_CREATE_CLAN = 190,
		EMI_CLAN_NAME_INCORRECT = 261,
		EMI_CLAN_NAME_TOO_LONG = 262,

		EMI_CLAN_CREATED = 189,
		EMI_CLAN_LVL_3_NEEDED_TO_ENDOWE_TITLE = 271,
		EMI_CLAN_LVL_3_NEEDED_TO_SET_CREST = 272,

		EMI_CANNOT_INVITE_YOURSELF = 4,
		EMI_S1_WORKING_WITH_ANOTHER_CLAN = 10,
		EMI_ENTERED_THE_CLAN = 195,
		EMI_S1_REFUSED_TO_JOIN_CLAN = 196,
		EMI_S1_HAS_JOINED_CLAN = 222,
		EMI_CLAN_MEMBER_S1_LOGGED_IN = 304,

		EMI_CLAN_LEVEL_INCREASED = 274,
		EMI_FAILED_TO_INCREASE_CLAN_LEVEL = 275,

		EMI_CLAN_MEMBER_S1_EXPELLED = 191,
		EMI_CLAN_MEMBERSHIP_TERMINATED = 199,

		EMI_CLAN_EMBLEM_WAS_SUCCESSFULLY_REGISTERED = 1663,

		EMI_YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_CLAN_WAREHOUSE = 709,
		EMI_ONLY_LEVEL_1_CLAN_OR_HIGHER_CAN_USE_WAREHOUSE = 710,
		EMI_ONLY_CLAN_LEADER_CAN_RETRIEVE_ITEMS_FROM_CLAN_WAREHOUSE = 1039,
		EMI_TITLE_CHANGED = 214,

		EMI_CLAN_INFO_HEAD = 496,
		EMI_CLAN_INFO_NAME = 497,
		EMI_CLAN_INFO_LEADER = 498,
		EMI_CLAN_INFO_LEVEL = 499,
		EMI_CLAN_INFO_SEPARATOR = 500,
		EMI_CLAN_INFO_FOOT = 501,

		//pickup items
		EMI_YOU_PICKED_UP_S1_ADENA = 28,
		EMI_YOU_PICKED_UP_S1_S2 = 29,
		EMI_YOU_PICKED_UP_S1 = 30,	
		EMI_S1_PICKED_UP_S2_S3 = 299,
		EMI_S1_PICKED_UP_S2 = 300,
		EMI_FAILED_TO_PICKUP_S1_ADENA = 55,
		EMI_FAILED_TO_PICKUP_S1 = 56,
		EMI_FAILED_TO_PICKUP_S2_S1_s = 57,

		//GM LIST
		EMI_GM_LIST = 703,
		EMI_GM_S1 = 704,
		EMI_THE_PERSON_IS_IN_MESSAGE_REFUSAL_MODE = 176,
		EMI_MESSAGE_REFUSAL_MODE = 177,
		EMI_MESSAGE_ACCEPTANCE_MODE = 178,

		// loc messages
		EMI_LOC_TI_S1_S2_S3 = 910,
		EMI_LOC_GLUDIN_S1_S2_S3 = 911,
		EMI_LOC_GLUDIO_S1_S2_S3 = 912,
		EMI_LOC_NETRAL_ZONE_S1_S2_S3 = 913,
		EMI_LOC_ELVEN_S1_S2_S3 = 914,
		EMI_LOC_DARK_ELVEN_S1_S2_S3 = 915,
		EMI_LOC_DION_S1_S2_S3 = 916,
		EMI_LOC_FLORAN_S1_S2_S3 = 917,
		EMI_LOC_GIRAN_S1_S2_S3 = 918,
		EMI_LOC_GIRAN_HARBOR_S1_S2_S3 = 919,
		EMI_LOC_ORC_S1_S2_S3 = 920,
		EMI_LOC_DWARVEN_S1_S2_S3 = 921,
		EMI_LOC_OREN_S1_S2_S3 = 922,
		EMI_LOC_HUNTER_S1_S2_S3 = 923,
		EMI_LOC_ADEN_S1_S2_S3 = 924,
		EMI_LOC_COLISEUM_S1_S2_S3 = 925,
		EMI_LOC_HEINE_S1_S2_S3 = 926,
		EMI_LOC_RUNE_S1_S2_S3 = 1537,
		EMI_LOC_GODDARD_S1_S2_S3 = 1538,    

		//Crystallize
		EMI_CRYSTALLIZE_LEVEL_TOO_LOW = 562,
		EMI_S1_CANNOT_BE_USED = 113,

		//Monster Derby
		EMI_ACQUIRED = 371,
		EMI_MONSRACE_NO_PAYOUT_INFO = 1044,
		EMI_MONSRACE_TICKETS_NOT_AVAILABLE = 1046,
		EMI_MONSRACE_TICKETS_AVAILABLE_FOR_S1_RACE = 816,
		EMI_MONSRACE_TICKETS_NOW_AVAILABLE_FOR_S1_RACE = 817,
		EMI_MONSRACE_TICKETS_STOP_IN_S1_MINUTES = 818,
		EMI_MONSRACE_TICKET_SALES_CLOSED = 819,
		EMI_MONSRACE_BEGINS_IN_S1_MINUTES = 820,
		EMI_MONSRACE_BEGINS_IN_30_SECONDS = 821,
		EMI_MONSRACE_COUNTDOWN_IN_FIVE_SECONDS = 822,
		EMI_MONSRACE_BEGINS_IN_S1_SECONDS = 823,
		EMI_MONSRACE_RACE_START = 824,
		EMI_MONSRACE_RACE_END = 825,
		EMI_MONSRACE_FIRST_PLACE_S1_SECOND_S2 = 826,

		// Naming conventions
		EMI_NAMING_THERE_IS_A_SPACE = 581,		
		EMI_NAMING_INAPPROPRIATE_CHARACTER_NAME = 582,		
		EMI_NAMING_INCLUDES_FORBIDDEN_WORDS = 583,		
		EMI_NAMING_ALREADY_IN_USE_BY_ANOTHER_PET = 584,
		EMI_NAMING_PETNAME_UP_TO_8CHARS = 548, 
		EMI_NAMING_NAME_PET = 535,
		EMI_NAMING_YOU_CANNOT_SET_NAME_OF_THE_PET = 695,
		EMI_NAMING_NAME_ALREADY_EXISTS = 79,	
		EMI_NAMING_CHARNAME_UP_TO_16CHARS = 80,	
		EMI_NAMING_PETNAME_CONTAINS_INVALID_CHARS = 591,		

		//Pets
		EMI_ITEM_NOT_FOR_PETS = 544,
		EMI_DEAD_PET_CANNOT_BE_RETURNED = 589,
		EMI_CANNOT_GIVE_ITEMS_TO_DEAD_PET = 590,
		EMI_CANNOT_EQUIP_PET_ITEM = 600,
		EMI_PET_EARNED_S1_EXP = 1014,
		EMI_PET_RECEIVED_DAMAGE_OF_S2_BY_S1 = 1016,
		EMI_PET_CRITICAL_HIT = 1017,
		EMI_PET_DID_S1_DMG = 1015,
		EMI_S1_GAME_PET_S2_DMG = 1016,
		EMI_PET_CANNOT_USE_ITEM = 972,
		EMI_PET_TOOK_S1_BECAUSE_HE_WAS_HUNGRY = 1527,
		EMI_YOU_CANNOT_RESTORE_HUNGRY_PETS = 594,
		EMI_PET_CANNOT_SENT_BACK_DURING_BATTLE = 579,
		EMI_YOU_ALREADY_HAVE_A_PET = 543,
		EMI_YOU_CANNOT_SUMMON_IN_COMBAT = 578,

		EMI_STRIDER_CANT_BE_RIDDEN_WHILE_DEAD = 1009,
		EMI_DEAD_STRIDER_CANT_BE_RIDDEN = 1010,
		EMI_STRIDER_IN_BATLLE_CANT_BE_RIDDEN = 1011,
		EMI_STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE = 1012,
		EMI_STRIDER_CAN_BE_RIDDEN_ONLY_WHILE_STANDING = 1013,

		//Summons
		EMI_SUMMON_GAVE_DAMAGE_OF_S1 = 1026,
		EMI_SUMMON_RECEIVED_DAMAGE_OF_S2_BY_S1 = 1027,
		EMI_SUMMON_CRITICAL_HIT = 1028,
		EMI_SUMMON_A_PET = 547,
		EMI_CUBIC_SUMMONING_FAILED = 568,
		EMI_SUMMONING_SERVITOR_COSTS_S2_S1 = 1197,

		// enchants
		EMI_S1_SUCCESSFULLY_ENCHANTED = 62,
		EMI_S1_S2_SUCCESSFULLY_ENCHANTED = 63,
		EMI_ENCHANTMENT_FAILED_S1_EVAPORATED = 64,
		EMI_ENCHANTMENT_FAILED_S1_S2_EVAPORATED = 65,
		EMI_SELECT_ITEM_TO_ENCHANT = 303,
		EMI_INAPPROPRIATE_ENCHANT_CONDITION = 355,
		EMI_BLESSED_ENCHANT_FAILED = 1517,
		EMI_ENCHANT_SCROLL_CANCELLED = 423,

		// Equip related
		EMI_EQUIPMENT_S1_S2_REMOVED = 1064,
		EMI_S1_DISARMED = 417,
		EMI_S1_S2_EQUIPPED = 368,
		EMI_S1_EQUIPPED = 49,


		// SevenSign
		EMI_QUEST_EVENT_PERIOD = 1176,
		EMI_VALIDATION_PERIOD = 1177,
		// EMI_AVARICE_DESCRIPTION = 1178,
		// EMI_GNOSIS_DESCRIPTION = 1179,
		// EMI_STRIFE_DESCRIPTION = 1180,
		EMI_INITIAL_PERIOD = 1183,
		EMI_RESULTS_PERIOD = 1184,
		EMI_QUEST_EVENT_PERIOD_BEGUN = 1210,
		EMI_QUEST_EVENT_PERIOD_ENDED = 1211,
		EMI_DAWN_OBTAINED_AVARICE = 1212,
		EMI_DAWN_OBTAINED_GNOSIS = 1213,
		EMI_DAWN_OBTAINED_STRIFE = 1214,
		EMI_DUSK_OBTAINED_AVARICE = 1215,
		EMI_DUSK_OBTAINED_GNOSIS = 1216,
		EMI_DUSK_OBTAINED_STRIFE = 1217,
		EMI_SEAL_VALIDATION_PERIOD_BEGUN = 1218,
		EMI_SEAL_VALIDATION_PERIOD_ENDED = 1219,
		EMI_DAWN_WON = 1241,
		EMI_DUSK_WON = 1240,
		EMI_PREPARATIONS_PERIOD_BEGUN = 1260,
		EMI_COMPETITION_PERIOD_BEGUN = 1261,
		EMI_RESULTS_PERIOD_BEGUN = 1262,
		EMI_VALIDATION_PERIOD_BEGUN = 1263,
		EMI_CONTRIB_SCORE_INCREASED = 1267,
		EMI_SEVENSIGNS_PARTECIPATION_DAWN = 1273,
		EMI_SEVENSIGNS_PARTECIPATION_DUSK = 1274,
		EMI_FIGHT_FOR_AVARICE = 1275,
		EMI_FIGHT_FOR_GNOSIS = 1276,
		EMI_FIGHT_FOR_STRIFE = 1277,
		EMI_CONTRIB_SCORE_EXCEEDED = 1279,
		EMI_UNTIL_MONDAY_6PM = 1286,
		EMI_UNTIL_TODAY_6PM = 1287,
		// EMI_S1_WILL_WIN_COMPETITION = 1288,
		EMI_SEAL_OWNED_10_MORE_VOTED = 1289,
		EMI_SEAL_NOT_OWNED_35_MORE_VOTED = 1290,
		EMI_SEAL_OWNED_10_LESS_VOTED = 1291,
		EMI_SEAL_NOT_OWNED_35_LESS_VOTED = 1292,
		// EMI_COMPETITION_WILL_TIE = 1293,
		EMI_COMPETITION_TIE_SEAL_NOT_AWARDED = 1294,
		EMI_CAN_BE_USED_BY_DAWN = 1301,
		EMI_CAN_BE_USED_BY_DUSK = 1302,


		//wars
		EMI_WAR_WITH_THE_S1_CLAN_HAS_BEGUN = 215,
		EMI_WAR_WITH_THE_S1_CLAN_HAS_ENDED = 216,
		EMI_YOU_HAVE_WON_THE_WAR_OVER_THE_S1_CLAN = 217,
		EMI_YOU_HAVE_SURRENDERED_TO_THE_S1_CLAN = 218,
		EMI_REQUEST_TO_END_WAR_HAS_BEEN_DENIED = 228,
		EMI_YOU_HAVE_PERSONALLY_SURRENDERED_TO_THE_S1_CLAN = 250,
		EMI_WAR_PROCLAMATION_HAS_BEEN_REFUSED = 626,

		//alliance
		EMI_FEATURE_ONLY_FOR_ALLIANCE_LEADER = 464,
		EMI_NO_CURRENT_ALLIANCES = 465,
		EMI_CANT_ENTER_ALLIANCE_WITHIN_1_DAY = 468,
		EMI_MAY_NOT_ALLY_CLAN_BATTLE = 469,
		EMI_ONLY_CLAN_LEADER_WITHDRAW_ALLY = 470,
		EMI_ALLIANCE_LEADER_CANT_WITHDRW= 471,
		EMI_DIFFERANT_ALLIANCE = 473,
		EMI_CLAN_DOESNT_EXISTS = 474,
		EMI_NO_RESPONSE_INVIT_CANCEL = 477,
		EMI_NO_RESPONSE_ENTRANCE_CANCEL = 478,
		EMI_ALREADY_JOINED_ALLIANCE = 502,
		EMI_ONLY_CLAN_LEADER_CREATE_ALLIANCE = 504,
		EMI_CANT_CREATE_ALLIANCE_10_DAYS_DISOLUTION = 505,
		EMI_INCORRECT_ALLIANCE_NAME = 506,
		EMI_INCORRECT_ALLIANCE_NAME_LENGTH = 507,
		EMI_ALLIANCE_ALREADY_EXISTS = 508,
		EMI_CANT_ACCEPT_ALLY_ENEMY_FOR_SIEGE = 509,
		EMI_YOU_INVITED_FOR_ALLIANCE = 510,
		EMI_SELECT_USER_TO_INVITE = 511,
		EMI_DO_YOU_WISH_TO_WITHDRW = 512,
		EMI_ENTER_NAME_CLAN_TO_EXPEL = 513,
		EMI_DO_YOU_WISH_TO_DISOLVE = 514,
		EMI_YOU_ACCEPTED_ALLIANCE = 517,
		EMI_FAILED_TO_INVITE_CLAN_IN_ALLIANCE = 518,
		EMI_YOU_HAVE_WITHDRAWN_FROM_ALLIANCE = 519,
		EMI_YOU_HAVE_FAILED_TO_WITHDRAWN_FROM_ALLIANCE = 520,
		EMI_YOU_HAVE_EXPELED_A_CLAN = 521,
		EMI_FAILED_TO_EXPELED_A_CLAN = 522,
		EMI_ALLIANCE_DISOLVED = 523,
		EMI_FAILED_TO_DISOLVE_ALLIANCE = 524,
		EMI_S2_ALLIANCE_LEADER_OF_S1_REQUESTED_ALLIANCE = 527,
		EMI_S1_CLAN_ALREADY_MEMBER_OF_S2_ALLIANCE = 691,

		EMI_ALLIANCE_INFO_HEAD = 491,
		EMI_ALLIANCE_NAME_S1 = 492,
		EMI_CONNECTION_S1_TOTAL_S2 = 493,
		EMI_ALLIANCE_LEADER_S2_OF_S1 = 494,
		EMI_ALLIANCE_CLAN_TOTAL_S1 = 495,

		//Friend
		EMI_SI_INVITED_YOU_AS_FRIEND = 516,
		EMI_INVITED_A_FRIEND = 525,
		EMI_FAILED_TO_INVITE_A_FRIEND = 526,
		EMI_S1_ADDED_TO_FRIENDS = 132,
		EMI_S1_JOINED_AS_FRIEND = 479,
		EMI_FRIEND_S1_HAS_LOGGED_IN = 503,

		EMI_FAILED_TO_REGISTER_TO_IGNORE_LIST = 615,
		EMI_S1_WAS_ADDED_TO_YOUR_IGNORE_LIST = 617,
		EMI_S1_WAS_REMOVED_FROM_YOUR_IGNORE_LIST = 618,
		EMI_S1_HAS_ADDED_YOU_TO_IGNORE_LIST = 619,

		EMI_FRIEND_LIST_HEAD = 487,
		EMI_S1_ONLINE = 488,
		EMI_S1_OFFLINE = 489,
		EMI_FRIEND_LIST_FOOT = 490,

		//
		EMI_S1_S2 = 614,
		EMI_CANT_LOGOUT_WHILE_FIGHTING = 0x65,
		EMI_CANT_RESTART_WHILE_FIGHTING = 0x66,
		EMI_ENTER_FILE_NAME_CREST = 515,
		EMI_FILE_NOT_FOUND = 528,
		EMI_S1_ROLLED_S2 = 814,
		EMI_NO_GM_PROVIDING_SERVICE_NOW = 702,
		EMI_TARGET_TOO_FAR = 22,
		EMI_S1_DISAPPEARED = 302,
		EMI_INCORRECT_TARGET = 109,

		EMI_S1_DIED_DROPPED_S3_S2 = 1208,//$s1 died and dropped $s3 $s2.

		//manor
		EMI_SEED_SUCCESSFULLY_SOWN = 889,
		EMI_SEED_NOT_SOWN = 890,
		EMI_SEED_CANNOT_BE_SOWN_HERE = 882,

		//Recommedations
		EMI_YOU_CANNOT_RECOMMEND_YOURSELF = 829,
		EMI_YOU_HAVE_BEEN_RECOMMENDED = 831,
		EMI_YOU_HAVE_RECOMMENDED = 830,
		EMI_THAT_CHARACTER_IS_RECOMMENDED = 832,
		EMI_NO_MORE_RECOMMENDATIONS_TO_HAVE = 833,
		EMI_ONLY_LEVEL_SUP_10_CAN_RECOMMEND = 898,
		EMI_YOU_NO_LONGER_RECIVE_A_RECOMMENDATION = 1188,

		EMI_NPC_SERVER_NOT_OPERATING = 1278,

		//Craft and Recipes Related 
		EMI_RECIPE_ALREADY_REGISTERED = 840, 
		EMI_NO_FUTHER_RECIPES_CAN_BE_ADDED = 841, 
		EMI_NOT_AUTHORIZED_TO_REGISTER_RECIPE = 642, 
		EMI_CANT_ALTER_RECIPEBOOK_WHILE_CRAFTING = 853, 
		EMI_CANT_REGISTER_NO_ABILITY_TO_CRAFT = 1061, 

		// enter/exit mother tree 
		EMI_ENTER_SHADOW_MOTHER_TREE = 0x72, 
		EMI_EXIT_SHADOW_MOTHER_TREE = 0x73, 

		// Formal Wear
		EMI_CANNOT_USE_ITEMS_SKILLS_WITH_FORMALWEAR = 1604,

		// Olympiad
		EMI_YOU_WILL_ENTER_THE_OLYMPIAD_STADIUM_IN_S1_SECOND_S = 1492,
		EMI_THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_ENDS_THE_GAME = 1493,
		EMI_THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_DOES_NOT_MEET_THE_REQUIREMENTS_FOR_JOINING_THE_GAME = 1494,
		EMI_THE_GAME_WILL_START_IN_S1_SECOND_S = 1495,
		EMI_STARTS_THE_GAME = 1496,
		EMI_S1_HAS_WON_THE_GAME = 1497,
		EMI_THE_GAME_ENDED_IN_A_TIE = 1498,
		EMI_YOU_WILL_GO_BACK_TO_THE_VILLAGE_IN_S1_SECOND_S = 1499,
		EMI_YOU_CANT_JOIN_THE_OLYMPIAD_WITH_A_SUB_JOB_CHARACTER = 1500,
		EMI_ONLY_NOBLESS_CAN_PARTICIPATE_IN_THE_OLYMPIAD = 1501,
		EMI_YOU_HAVE_ALREADY_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_AN_EVENT = 1502,
		EMI_YOU_HAVE_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_CLASSIFIED_GAMES = 1503,
		EMI_YOU_HAVE_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_NO_CLASS_GAMES = 1504,
		EMI_YOU_HAVE_BEEN_DELETED_FROM_THE_WAITING_LIST_OF_A_GAME = 1505,
		EMI_YOU_HAVE_NOT_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_A_GAME = 1506,
		EMI_THIS_ITEM_CANT_BE_EQUIPPED_FOR_THE_OLYMPIAD_EVENT = 1507,
		EMI_THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT = 1508,
		EMI_THIS_SKILL_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT = 1509,
		EMI_OLYMPIAD_PERIOD_S1_HAS_STARTED = 1639,
		EMI_OLYMPIAD_PERIOD_S1_HAS_ENDED = 1640,
		EMI_THE_OLYMPIAD_GAME_HAS_STARTED = 1641,
		EMI_THE_OLYMPIAD_GAME_HAS_ENDED = 1642,
		EMI_THE_OLYMPIAD_GAME_IS_NOT_CURRENTLY_IN_PROGRESS = 1651,
		EMI_S1_HAS_GAINED_S2_OLYMPIAD_POINTS = 1657,
		EMI_S1_HAS_LOST_S2_OLYMPIAD_POINTS = 1658,
		EMI_THE_PRESENT_RECORD_DURING_THE_CURRENT_OLYMPIAD_SESSION_IS_S1_WINS_S2_DEFEATS_YOU_HAVE_EARNED_S3_OLYMPIAD_POINTS = 1673,
		EMI_YOU_ARE_ALREADY_ON_THE_WAITING_LIST_TO_PARTICIPATE_IN_THE_GAME_FOR_YOUR_CLASS = 1689,
		EMI_YOU_ARE_ALREADY_ON_THE_WAITING_LIST_FOR_ALL_CLASSES_WAITING_TO_PARTICIPATE_IN_THE_GAME = 1690,
		EMI_SINCE_80_PERCENT_OR_MORE_OF_YOUR_INVENTORY_SLOTS_ARE_FULL_YOU_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD = 1691,
		EMI_SINCE_YOU_HAVE_CHANGED_YOUR_CLASS_INTO_A_SUB_JOB_YOU_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD = 1692,
		EMI_WHILE_YOU_ARE_ON_THE_WAITING_LIST_YOU_ARE_NOT_ALLOWED_TO_WATCH_THE_GAME = 1693,

		// Unlock
		EMI_UNABLE_TO_UNLOCK_DOOR = 319,
		EMI_FAILED_TO_UNLOCK_DOOR = 320,


		// Cursed weapon related
		EMI_THERE_IS_S1_HOUR_AND_S2_MINUTE_LEFT_OF_THE_FIXED_USAGE_TIME = 1813,
		EMI_S2_MINUTE_OF_USAGE_TIME_ARE_LEFT_FOR_S1 = 1814,
		EMI_S2_WAS_DROPPED_IN_THE_S1_REGION = 1815,
		EMI_THE_OWNER_OF_S2_HAS_APPEARED_IN_THE_S1_REGION = 1816,
		EMI_S2_OWNER_HAS_LOGGED_INTO_THE_S1_REGION = 1817,
		EMI_S1_HAS_DISAPPEARED = 1818,

		EMI_RESSURECTION_REQUEST = 1510,

		//  Energy Stones
		EMI_FORCE_INCREASED_TO_S1 = 323,
		EMI_FORCE_MAXLEVEL_REACHED = 324,

		// Fishing related
		EMI_CANNOT_DO_WHILE_FISHING_1 = 1447,
		EMI_ONLY_FISHING_SKILLS_NOW = 1448,
		EMI_GOT_A_BITE = 1449,
		EMI_FISH_SPIT_THE_HOOK = 1450,
		EMI_BAIT_STOLEN_BY_FISH = 1451,
		EMI_BAIT_LOST_FISH_GOT_AWAY = 1452,
		EMI_FISHING_POLE_NOT_EQUIPPED = 1453,
		EMI_BAIT_ON_HOOK_BEFORE_FISHING = 1454,
		EMI_CANNOT_FISH_UNDER_WATER = 1455,
		EMI_CANNOT_FISH_ON_BOAT = 1456,
		EMI_CANNOT_FISH_HERE = 1457,
		EMI_FISHING_ATTEMPT_CANCELLED = 1458,
		EMI_NOT_ENOUGH_BAIT = 1459,
		EMI_REEL_LINE_AND_STOP_FISHING = 1460,
		EMI_CAST_LINE_AND_START_FISHING = 1461,
		EMI_CAN_USE_PUMPING_ONLY_WHILE_FISHING = 1462,
		EMI_CAN_USE_REELING_ONLY_WHILE_FISHING = 1463,
		EMI_FISH_RESISTED_ATTEMPT_TO_BRING_IT_IN = 1464,
		EMI_PUMPING_SUCCESFUL_S1_DAMAGE = 1465,
		EMI_FISH_RESISTED_PUMPING_S1_HP_REGAINED = 1466,
		EMI_REELING_SUCCESFUL_S1_DAMAGE = 1467,
		EMI_FISH_RESISTED_REELING_S1_HP_REGAINED = 1468,
		EMI_YOU_CAUGHT_SOMETHING = 1469,
		EMI_CANNOT_DO_WHILE_FISHING_2 = 1470,
		EMI_CANNOT_DO_WHILE_FISHING_3 = 1471,
		EMI_CANNOT_ATTACK_WITH_FISHING_POLE = 1472,
		EMI_WRONG_FISHINGSHOT_GRADE = 1479,
		EMI_CANNOT_FISH_WHILE_USING_RECIPE_BOOK = 1638,
		EMI_YOU_CAUGHT_SOMETHING_SMELLY_THROW_IT_BACK = 1655,
		EMI_FISH_NO_MORE_BITING_TRY_OTHER_LOCATION = 1662,
		EMI_FISH_RESISTING_LOOK_BOBBLER = 1664,
		EMI_YOU_WORN_FISH_OUT = 1665,
		EMI_NOTHING_INSIDE_THAT = 1669,
		EMI_REELING_PUMPING_3_LEVELS_HIGHER_THAN_FISHING_PENALTY = 1670,
		EMI_REELING_SUCCESSFUL_PENALTY_S1 = 1671,
		EMI_PUMPING_SUCCESSFUL_PENALTY_S1 = 1672,

		// Game Time messages
		EMI_TIME_S1_S2_IN_THE_DAY = 927,
		EMI_TIME_S1_S2_IN_THE_NIGHT = 928
	};

	class CSPSystemMessage : public CServerPacket
	{
	public:

		CSPSystemMessage(E_MessageId id)
		: CServerPacket(), MessageId(id)
		{
			Priority = EPP_LOW;
		};

		CSPSystemMessage(irr::core::stringc str)
		: CServerPacket(), MessageId(EMI_S1_S2)
		{
			Priority = EPP_LOW;

			addString(str);
		};

		virtual ~CSPSystemMessage() {};

		void addString(irr::core::stringc str)
		{
			SType t;
			t.Type = EAT_TEXT;
			t.Str = str;
			Types.push_back(t);
		};

		void addNumber(irr::s32 num)
		{
			SType t;
			t.Type = EAT_NUMBER;
			t.Data = num;
			Types.push_back(t);
		};

		void addNpcName(irr::u32 npc_id)
		{
			SType t;
			t.Type = EAT_NPC_NAME;
			t.Data = npc_id + 1000000;
			Types.push_back(t);
		};

		void addItemName(irr::u32 item_id)
		{
			SType t;
			t.Type = EAT_ITEM_NAME;
			t.Data = item_id;
			Types.push_back(t);
		};

		void addSkillName(irr::u32 skill_id)
		{
			SType t;
			t.Type = EAT_SKILL_NAME;
			t.Data = skill_id;
			Types.push_back(t);
		};

		virtual bool writePacket()
		{
			if(!Writen)
			{
				Writen = true;
				w8(0x64);

				w32((irr::s32)MessageId);
				w32(Types.size());

				for(irr::u32 i = 0; i < Types.size(); i++)
				{
					w32((irr::s32)Types[i].Type);

					switch(Types[i].Type)
					{
						case EAT_TEXT:
							wStrW(Types[i].Str);
							break;
						case EAT_NUMBER:
						case EAT_NPC_NAME:
						case EAT_ITEM_NAME:
							w32(Types[i].Data);
							break;
						case EAT_SKILL_NAME:
							w32(Types[i].Data);
							w32(1);
							break;
					}
				}
			}

			return true;
		};

		virtual irr::c8* getData()
		{
			return Data;
		};

		virtual irr::u32 getLen()
		{
			return WritePointer;
		};

	private:

		struct SType
		{
			E_AddType Type;
			irr::u32 Data;
			irr::core::stringc Str;
		};

		E_MessageId MessageId;
		irr::core::array<SType> Types;

	};

}
}

#endif
